#!/usr/bin/python3
# -*- coding: utf-8 -*-

"""
# @version: v1.0
# @author : wlisingle
# @Email : 19688513@qq.com
# @Project : g-carbon-bio
# @File : stock_historical_data.py
# @Software: PyCharm
# @time: 2025/2/17 19:38
# @description : 历史行情数据
"""

class StockHistoricalData:
    def __init__(self, date: str, stock_code: str, open_price: float, close_price: float,
                 high_price: float, low_price: float, volume: int, turnover: float,
                 amplitude: float, change_rate: float, change_amount: float,
                 turnover_rate: float) -> None:
        """
        初始化历史行情数据

        :param date: 日期
        :param stock_code: 股票代码
        :param open_price: 开盘价
        :param close_price: 收盘价
        :param high_price: 最高价
        :param low_price: 最低价
        :param volume: 成交量（单位：手）
        :param turnover: 成交额（单位：元）
        :param amplitude: 振幅（单位：%）
        :param change_rate: 涨跌幅（单位：%）
        :param change_amount: 涨跌额（单位：元）
        :param turnover_rate: 换手率（单位：%）
        """
        self.date = date
        self.stock_code = stock_code
        self.open_price = open_price
        self.close_price = close_price
        self.high_price = high_price
        self.low_price = low_price
        self.volume = volume
        self.turnover = turnover
        self.amplitude = amplitude
        self.change_rate = change_rate
        self.change_amount = change_amount
        self.turnover_rate = turnover_rate

    @property
    def date(self) -> str:
        """获取日期"""
        return self._date

    @date.setter
    def date(self, date: str) -> None:
        """设置日期"""
        self._date = date

    @property
    def stock_code(self) -> str:
        """获取股票代码"""
        return self._stock_code

    @stock_code.setter
    def stock_code(self, stock_code: str) -> None:
        """设置股票代码"""
        self._stock_code = stock_code

    @property
    def open_price(self) -> float:
        """获取开盘价"""
        return self._open_price

    @open_price.setter
    def open_price(self, open_price: float) -> None:
        """设置开盘价"""
        self._open_price = open_price

    @property
    def close_price(self) -> float:
        """获取收盘价"""
        return self._close_price

    @close_price.setter
    def close_price(self, close_price: float) -> None:
        """设置收盘价"""
        self._close_price = close_price

    @property
    def high_price(self) -> float:
        """获取最高价"""
        return self._high_price

    @high_price.setter
    def high_price(self, high_price: float) -> None:
        """设置最高价"""
        self._high_price = high_price

    @property
    def low_price(self) -> float:
        """获取最低价"""
        return self._low_price

    @low_price.setter
    def low_price(self, low_price: float) -> None:
        """设置最低价"""
        self._low_price = low_price

    @property
    def volume(self) -> int:
        """获取成交量（单位：手）"""
        return self._volume

    @volume.setter
    def volume(self, volume: int) -> None:
        """设置成交量（单位：手）"""
        self._volume = volume

    @property
    def turnover(self) -> float:
        """获取成交额（单位：元）"""
        return self._turnover

    @turnover.setter
    def turnover(self, turnover: float) -> None:
        """设置成交额（单位：元）"""
        self._turnover = turnover

    @property
    def amplitude(self) -> float:
        """获取振幅（单位：%）"""
        return self._amplitude

    @amplitude.setter
    def amplitude(self, amplitude: float) -> None:
        """设置振幅（单位：%）"""
        self._amplitude = amplitude

    @property
    def change_rate(self) -> float:
        """获取涨跌幅（单位：%）"""
        return self._change_rate

    @change_rate.setter
    def change_rate(self, change_rate: float) -> None:
        """设置涨跌幅（单位：%）"""
        self._change_rate = change_rate

    @property
    def change_amount(self) -> float:
        """获取涨跌额（单位：元）"""
        return self._change_amount

    @change_amount.setter
    def change_amount(self, change_amount: float) -> None:
        """设置涨跌额（单位：元）"""
        self._change_amount = change_amount

    @property
    def turnover_rate(self) -> float:
        """获取换手率（单位：%）"""
        return self._turnover_rate

    @turnover_rate.setter
    def turnover_rate(self, turnover_rate: float) -> None:
        """设置换手率（单位：%）"""
        self._turnover_rate = turnover_rate

    def __str__(self):
        return (f"日期: {self.date}, 股票代码: {self.stock_code}, 开盘: {self.open_price}, "
                f"收盘: {self.close_price}, 最高: {self.high_price}, 最低: {self.low_price}, "
                f"成交量: {self.volume}, 成交额: {self.turnover}, "
                f"振幅: {self.amplitude}, 涨跌幅: {self.change_rate}, "
                f"涨跌额: {self.change_amount}, 换手率: {self.turnover_rate}")